Repository navigation
perf(web): split heavy chat chunks and group startup bundles - #1096
Merged
Merged
Conversation
High-rate streaming deltas, session sweeps, and projection writes were triggering redundant SQLite reads, full-row JSON rewrites, and repeated full read-model hydrations on the main thread. - Return early in ProviderService.listSessions when no adapters are active and fetch bindings only for active session thread IDs. - Route content.delta runtime ingestion through a narrow active-thread lookup (session and live side-turns) instead of four-query shell hydration with diff-stat rollups. - Update only updated_at in ProjectionPipeline for assistant messages and activities, guard subagent roster reads behind activityMayAffectSubagents, skip streaming session lookups and no-op turn upserts, and drop redundant correlated subqueries from message upserts. - Guard Claude partial tool JSON decoding with outer-brace checks, enforce the 500 ms file-change estimate throttle before scanning, and scan partial JSON strings in linear-time slices. - Scope shell snapshot diff-stat rollups to active or archived threads and replace non-engine getCommandReadModel calls in ProjectSetupSource, LinkMoves, and single-thread ThreadMoves paths. - Drop six unused or prefix-redundant SQLite indexes in migration 126 and tune NodeSqliteClient with a 1024-entry statement cache, borrower-based statement execution, prepared transaction controls, and savepoint release. - Wake AssistantEvents discovery only on events that produce assistant actions, and nudge discovery on stale settlements.
Streaming turns and composer typing triggered redundant markdown parses, full-thread UI syncs, duplicated inbox derivations, and broad store re-renders in the web client, while the desktop app serialized shell probing ahead of startup, rasterized all 38 macOS tray icons upfront, and kept preview browser CDP buffers and accessibility active. Stabilize markdown link-kind state, cache per-block file-path scans, narrow backdrop observers on active chat threads, deduplicate thread shells structurally on modelSelection, switch thread upserts to single-thread UI sync, share one inbox derivation with narrower component selectors, overlap desktop shell probing with startup, rasterize macOS tray frames lazily on first use, and disable unused preview CDP response buffering and eager accessibility tracking.
…s async Reduces checkpoint git overhead, WebSocket fanout work, retained evicted thread memory, idle reveal animation frames, and blocking main-thread log and cache writes. - Coordinate pre-turn checkpoints across ProviderCommandReactor and CheckpointReactor, shard checkpoint work across threads with per-checkout revert serialization, and cache stable git lookups in scratchIndex. - Share one coalesced shell stream producer across WebSocket clients, bound shell and thread subscriber queues with clean resync on overflow, and return only the sequence on event store appends. - Release evicted thread detail slices and derivation caches while pausing idle eviction offline and preserving pending scroll anchors and worktree locks. - Create streaming text reveal observers lazily, stop idle animation frames when caught up, and advance only the live reveal tail. - Move rotating trace and provider logs to fs.promises with per-path rotation locks and shutdown flush, batch desktop child logs, optimize terminal ANSI scans and output bursts, compact usage rate caches, and debounce usage scan cache writes.
Reduces background polling, process spawns, memory retention, and hot-path work across server, web, desktop, shared, and client-runtime without changing user-visible behavior. - Relay: pass fixed ArrayBuffer views directly to WebCrypto, build header-prefixed records in one allocation, and avoid double-copying single-part frames. - Providers: slow disabled provider scheduled refreshes by 6x, cap refreshAll concurrency to 3, cache scheduled Claude token usage within the same UTC day, and cache claude --version by resolved executable stat metadata. - Git and workspace: skip numstat diffs on clean status checks, reuse status GitConfigSnapshot in GitManager, cap background remote refreshes to 4 with post-permit re-checks, and filter ignored tracked files via git ls-files --cached --ignored. - Pull requests: raise viewer and repository cache capacities to 64, run authored searches in parallel with workspace listings, share worktree listings per sweep with fresh revalidation before auto-merge, and back off confirmed missing worktrees. - Server and client cleanups: cache ProjectFaviconResolver lookups, stop retaining raw SDK messages in ClaudeAdapter turnState.items, tag OpenCode and ACP streaming chunks as stream fragments, cache compiled search regexes, track MJPEG scan cursors, replace Equal.equals on work rows, skip redundant activity sorts, lazy-load DiffWorkerPoolProvider, pause the desktop backdrop CPU watchdog when art is still or hidden, and cache mainFrameId in PreviewAutomation.
Opening a chat thread eagerly downloaded and parsed 198 static JS files (5,723 KB raw, 1,814 KB gzipped), including `@pierre/diffs`, the VS Code file icon catalog, the GitHub HTML sanitizer, and panels and dialogs that start closed. Startup alone also pulled 96 separate files with 70 small chunks under 5 KB. This splits those features behind on-demand imports and groups stable initial libraries in Vite/Rolldown without pulling lazy code into startup: - Decouple `@pierre/diffs` from initial chat load, queue custom theme registrations until Pierre loads, recover from failed imports, and gate highlighter warm-up on fenced code blocks. - Load the VS Code file icon manifest on demand with a same-size fallback icon and reconnect retry. - Load the GitHub HTML markdown renderer only for GitHub HTML documents, and keep Find in chat indexing lazy while keeping the Find bar input, focus capture, and Escape handling eager. - Lazy-load closed-by-default side panels, dialogs, the theme picker, and scheduled task timeline lines, preserving Escape cancellation while chunks load and reserving row height for schedule lines. - Group initial React, Effect, TanStack, UI, contracts, and shared startup code in `apps/web/vite.config.ts`. This cuts initial chat thread JS by 942 KB raw (300 KB gzipped, -16.5%) and 45% fewer files, and drops app startup from 96 files to 8 files (-29 KB gzipped).
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Wait for RotatingFileSink.writeAsync to settle and for the flush fiber to reschedule before advancing TestClock in packages/shared/src/observability.test.ts, preventing the CI timeout race when async fs.promises calls finish after the test probe triggers. Group initial vendor and shared startup modules in apps/web/vite.config.ts using $initial and entriesAware rules so startup drops from 96 JS files to 8 files and stays 30 KB under the 915 KB gzip budget.
…-web-chunks # Conflicts: # apps/web/src/components/ChatView.tsx
…hunks # Conflicts: # apps/web/src/components/ChatMarkdown.tsx
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 25, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1095.
Opening a chat thread eagerly downloaded and parsed 198 static JS files (5,723 KB raw, 1,814 KB gzipped), including
@pierre/diffs, the VS Code file icon catalog, the GitHub HTML sanitizer, and closed-by-default panels and dialogs. App startup alone also loaded 96 separate files with 70 small chunks under 5 KB.What changed
@pierre/diffs(447 KB) from chat startup, queued custom code theme registrations until Pierre loads, cleared rejected import promises so transient failures recover, and gated highlighter warm-up on fenced code blocks so prose-only chats skip loading it.onlineretry recovery.codeSplittinggroups inapps/web/vite.config.tsfor initial React, Effect, TanStack, UI, contracts, and shared startup modules.apps/web/src/components/ChatView.panels.browser.tsxto wait for the lazy Source Control panel body after clicking its tab, matching the existing waits in the same test.Before and after bundle size
Measured from production builds of
chore/perf-apps-performance-auditversus this branch by tracing the exact static JS import graph for each screen.Verification
vp fmt,vp lint, andvp run typecheck(14/14 packages)vp run --cache '@threadlines/web#test'(273 test files, 3,408 tests)vp run --cache '@threadlines/web#test:browser'(118 test files, 1,215 tests)vp run '@threadlines/web#build'